def maxWindow(nums,length):
    '''输入数字列表和窗口大小，返回最大窗口的起始位置和长度
    '''
    maxValue = sum(nums[:length])
    windowsValue = maxValue
    for i in range(1, len(nums)-length+1):
        windowsValue = windowsValue-nums[i-1]+nums[i+length-1]
        if windowsValue>maxValue:
            maxValue=windowsValue
            start = i
    return start,maxValue

a = [1,2,4,9,1,2]
print(maxWindow(a,3))